import React from 'react'
import {  NavLink,   useNavigate,   useParams,   useRoutes } from 'react-router-dom'
 
import routes from "./router"

export default function App() {
  const navigate = useNavigate()

  const element = useRoutes(routes)
  return (
    <div>
      <NavLink to={'/home'} >home</NavLink>
      <NavLink to={'/about'} >about</NavLink>

      <button onClick={() => navigate('/home/xia/18')} >param传参</button>
      <button onClick={() => navigate('/home?name=xia&age=18')} >query传参</button>
      <button onClick={() => navigate('/home',{state:{name: 'xia', age: '18'}})} >state传参</button>
      <div>
        {element}
      </div>
 
    </div>
  )
}
